package com.bigdata.scala.iterator

import java.io.{BufferedReader, File, FileInputStream, FileReader}

import org.apache.commons.lang3.StringUtils

/**
 *
 * ${DESCRIPTION}
 *
 * @author Administrator
 * @version 1.0
 * @date 2021-12-12 14:16
 */
class BiddataFileIterator(fileName: String,
                          charsetName: String) extends Iterator[String]{

  private var line: String = _

  private val fileReader = new FileReader(fileName)

  private val bufferedReader = new BufferedReader(fileReader)

  override def hasNext: Boolean = {
    line = bufferedReader.readLine()

    StringUtils.isNotBlank(line)
  }

  override def next(): String = {
    line
  }
}
